package cn.wen.eeayjoke.ui;

import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentPagerAdapter;
import android.view.View;

import cn.wen.core.titlebar.DefTitleBar;
import cn.wen.core.ui.AppActivity;
import cn.wen.eeayjoke.R;
import cn.wen.eeayjoke.ui.pager.PagerFmtOne;
import cn.wen.eeayjoke.ui.pager.PagerFmtTwo;
import cn.wen.eeayjoke.view.directionalviewpager.DirectionalViewPager;

/**
 * Created by Administrator on 2018/7/7.
 */

public class PagerActivity extends AppActivity {
    private DirectionalViewPager mViewPager;

    @Override
    protected Object getContentLayout() {
        return R.layout.activity_pager;
    }

    @Override
    protected void initTitle(DefTitleBar titleBar) {

    }

    @Override
    protected void initView(View contentView) {
        setSwipeBackEnable(false);
        mViewPager = findViewById(R.id.view_pager);
        mViewPager.setOrientation(DirectionalViewPager.VERTICAL);
        mViewPager.setAdapter(new FragmentPagerAdapter(getSupportFragmentManager()) {
            @Override
            public Fragment getItem(int position) {
                if (position == 1) {
                    return new PagerFmtTwo();
                }
                return new PagerFmtOne();
            }

            @Override
            public int getCount() {
                return 3;
            }
        });

       // mViewPager.setPageTransformer(true,new VerticalPageTransformer());
        //mViewPager.setOverScrollMode(View.OVER_SCROLL_NEVER);
    }
}
